#include <iostream>
using namespace std;
typedef long long LL;
#define endl '\n'
void solve() 
{
    int n, k; cin >> n >> k;
    string s; cin >> s;
    int cnt1 = 0, cnt0 = 0;
    for(int i = 0; i < n; i++)
        if(s[i] == '1') cnt1++;
        else cnt0++;
    int minc = abs(cnt1 - cnt0) / 2;
    int maxc = cnt1 / 2 + cnt0 / 2;
    if(k >= minc && k <= maxc && (k - minc) % 2 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int T;
	cin >> T;
	while(T--)
	{
        solve();
	}
	return 0;
}